<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹起支付对话框</title>
</head>

<body>

    <div class="button" onclick="pay()">直接充值6元</div>
    <div class="button" onclick="pay2()">传递详情充值6元</div>
    <div class="button" onclick="pay3()">支付方式不选择充值</div>
    <div class="button" onclick="pay4()">默认支付方式使用微信</div>
</body>

<script>

    function pay() {
        console.log("直接充值6元")
        window.pupu && window.pupu.showPayDialog && window.pupu.showPayDialog(6)
        window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.showPayDialog && window.webkit.messageHandlers.showPayDialog.postMessage(6)
    }

    function pay2() {
        console.log("传递详情充值6元")
        window.pupu && window.pupu.showPayDialog && window.pupu.showPayDialog(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null")
        window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.showPayDialog && window.webkit.messageHandlers.showPayDialog.postMessage(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null")
    }

    function pay3() {
        console.log("支付方式不选择充值")
        window.pupu && window.pupu.showPayDialog && window.pupu.showPayDialog(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null", -1)
        window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.showPayDialog && window.webkit.messageHandlers.showPayDialog.postMessage(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null", -1)
    }

    function pay4() {
        console.log("默认支付方式使用微信")
        window.pupu && window.pupu.showPayDialog && window.pupu.showPayDialog(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null", 1)
        window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.showPayDialog && window.webkit.messageHandlers.showPayDialog.postMessage(6, "6元每日首充", "服务器规定的每日首充类型，没有传递 null", 1)
    }


    window.onPayCallback = function (isSucceed) {
        console.log(isSucceed ? "支付成功" : "支付失败")
    }


</script>

<script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
<script>
    // VConsole 默认会挂载到 `window.VConsole` 上
    var vConsole = new window.VConsole();
</script>

<style>
    .button {
        margin-top: 10vw;
        display: inline-block;
        background-color: bisque;
        border: 0.5vw solid;
        padding: 3vw;
    }
</style>

</html>